namespace ILWeaving;
//应用切面
public class OrderProcessor
{
    [LogAspect] // 应用切面
    public void ProcessOrder(string orderId, int quantity)
    {
        Console.WriteLine($"处理订单: {orderId}, 数量: {quantity}");
        // 模拟处理时间
        System.Threading.Thread.Sleep(new Random().Next(100, 300));
        if (quantity > 100)
        {
            throw new InvalidOperationException("数量超过限制");
        }
    }
    [LogAspect]
    public decimal CalculateTotal(decimal unitPrice, int quantity)
    {
        if (quantity <= 0)
            throw new ArgumentException("数量必须大于0");
        return unitPrice * quantity;
    }
}